package test1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class App {

	public static void insert() {
		 try{
	            Class.forName("com.pivotal.jdbc.GreenplumDriver");
	            Connection db = DriverManager.getConnection("jdbc:pivotal:greenplum://100.122.3.48:15374;DatabaseName=test", "gpadmin", "XE38rPkWr@XX9MOOQ$");
	            Statement st = db.createStatement();

	            for (int i=0;i<100000;i++){
					System.out.println(st.execute("insert into testzwl1 values ("+i+",'"+i+"')"));
				}


	            st.close();
	        }catch (Exception e){
	            e.printStackTrace();
	        }
	}

	public static void main(String[] args) {

		insert();

		/*
		 try{
	            Class.forName("com.pivotal.jdbc.GreenplumDriver");
	            Connection db = DriverManager.getConnection("jdbc:pivotal:greenplum://100.122.3.48:15374;DatabaseName=test", "gpadmin", "XE38rPkWr@XX9MOOQ$");
	            Statement st = db.createStatement();
	            ResultSet rs = st.executeQuery("select * from testzwl1 limit 10");
	            while (rs.next()) {
	                System.out.println(rs.getString(1));
	            }
	            rs.close();
	            st.close();
	        }catch (Exception e){
	            e.printStackTrace();
	        }
			*/


//        try {
//
//            String url = "jdbc:postgresql://100.122.3.48:15374/test";
//            Class.forName("org.postgresql.Driver");
//            Connection connection= DriverManager.getConnection(url, "userName", "password");
//            String sql ="select * from tableName";
//            Statement statement = connection.createStatement();
//
//            ResultSet resultSet = statement.executeQuery(sql);
//
//
//
//            resultSet.close();
//            statement.close();
//            connection.close();
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }

}
